<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Spiellobby für Multiplayer Schiffeversenken</title>
<link rel="stylesheet" type="text/css" href="css/schiffeversenken.css">
<script src="jquery-2.1.1.js"></script>

</head>
<body>

<div>
<img id="hintergrund" src="images/pergament.gif" alt="" title="" />
</div>

<jsp:useBean id="chatbean" class="logik.ChatBean" scope="application"/>

<c:if test="${param.name!=null}">
<jsp:setProperty property="login" name="chatbean" param="name"/>
</c:if>

<c:if test="${param.input!=null}">
<jsp:setProperty property="message" name="chatbean" param="input"/>
</c:if>

<div id="scrollbereich">
<div id="inhalt">

<h1>Mehrspieler Lobby</h1>

<div id="lobbyoutside">
<form name="nameform" action="javascript:login()">
<label for="input">Dein Name:</label>
<input id="name" type="text" name="name"> 
</form>
</div>

<div id="lobbyinside" >
<table>
<tr><td width="500"><div id="chat"></div></td>
<td><div id="users"></div></td></tr>
</table>


<br><br>

<form name="message" action="javascript:writemessage()">
<label for="input">Eingabe:</label>
<input id="input" type="text" name="input"> 
</form>
</div>

</div>
</div>


<script type="text/javascript">
$("#lobbyinside").hide();

function login() {
	//document.nameform.action="lobby.jsp";
	//document.nameform.submit();
	$("#lobbyoutside").hide();
	$("#lobbyinside").show();
}

function writemessage() {
	document.message.action="lobby.jsp";
	document.message.submit();
}

function getmessages(){
	$("#chat").load("chat.jsp #chatcontent");
	$("#users").load("chat.jsp #users");
}

function herausfordern(){
	alert("Sorry diese funktion ist noch nicht implementiert");
}

setInterval(getmessages, 2000);
</script>


</body>
</html>